<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jquery实现置顶和置底特效</title>
<meta name="author" content="" />
<meta name="Copyright" content="" />
<meta name="keywords" content="Jquery实现置顶和置底特效" />
<meta name="description" content="Jquery实现置顶和置底特效" />
<script type="text/javascript" src="jquery1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
	$("#updown").css("top",window.screen.availHeight/2-100+"px");
	$(window).scroll(function() {		
		if($(window).scrollTop() >= 100){
			$('#updown').fadeIn(300); 
		}else{    
			$('#updown').fadeOut(300);    
		}  
	});
	$('#updown .up').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);});
	$('#updown .down').click(function(){$('html,body').animate({scrollTop: document.body.clientHeight+'px'}, 800);});
});
</script>

<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>

<body>
<div id="top">
  <h2 class="subtitle">Jquery实现置顶和置底特效</h2>
  <div id="meun"><a href="" title="Jquery-School"><img src="http://www.jq-school.com/logo.png" /></a>
    <ul id="submeun">
      <li><a href="">首页</a></li>    
	   <li class="cur"><a href="javascript:void(0)">Jquery实现置顶和置底特效</a></li>
    </ul>
  </div>
  </div>
<div id="updown"><span class="up"></span><span class="down"></span></div>
</body>
</html>